LeftProjection

data class LeftProjection<out L, out R>(either: Either<L, R>)

Functions

all
Link copied to clipboard
common
inline fun all(predicate: (L) -> Boolean): Boolean
Returns the result of applying the predicate to the value if this is Left or true if this is Right.
any
Link copied to clipboard
common
inline fun any(predicate: (L) -> Boolean): Boolean
Returns the result of applying the predicate to the value if this is Left or false if this is Right.
filter
Link copied to clipboard
common
inline fun filter(predicate: (L) -> Boolean): Either<L, R>?
Returns the same Left if the predicate is satisfied for the value.
filterIsInstance
Link copied to clipboard
common
inline fun <T> filterIsInstance(): Either<T, R>?
Returns the same Left casted to type T if it is T.
filterIsInstanceToOption
Link copied to clipboard
common
inline fun <T> filterIsInstanceToOption(): Option<Either<T, R>>
Returns Some containing the same Left casted to type T if it is T.
filterNot
Link copied to clipboard
common
inline fun filterNot(predicate: (L) -> Boolean): Either<L, R>?
Returns the same Left if the predicate is not satisfied for the value.
filterNotToOption
Link copied to clipboard
common
inline fun filterNotToOption(predicate: (L) -> Boolean): Option<Either<L, R>>
Returns Some containing the same Left if the predicate is not satisfied for the value.
filterToOption
Link copied to clipboard
common
inline fun filterToOption(predicate: (L) -> Boolean): Option<Either<L, R>>
Returns Some containing the same Left if the predicate is satisfied for the value.
forEach
Link copied to clipboard
common
inline fun forEach(action: (L) -> Unit)
Runs action if this is a Left.
get
Link copied to clipboard
common
fun get(): L
Gets value of this Left.
getOrNull
Link copied to clipboard
common
fun getOrNull(): L?
Gets value of this Left or null if this is Right.
map
Link copied to clipboard
common
inline fun <T> map(transform: (L) -> T): Either<T, R>
Maps value of this Left using transform.
none
Link copied to clipboard
common
inline fun none(predicate: (L) -> Boolean): Boolean
Returns false if the predicate is met by the value if this is Left or true otherwise.
toOption
Link copied to clipboard
common
fun toOption(): Option<L>
Returns a Some containing the Left value if it exists, or a None if this is a Right.

Properties

either
Link copied to clipboard
common
val either: Either<L, R>

Extensions

filterNotNull
Link copied to clipboard
common
fun <L, R> LeftProjection<L?, R>.filterNotNull(): Either<L, R>?
Returns the same Left if its value is not null.
filterNotNullToOption
Link copied to clipboard
common
fun <L, R> LeftProjection<L?, R>.filterNotNullToOption(): Option<Either<L, R>>
Returns Some containing the same Left if its value is not null.
filterOrElse
Link copied to clipboard
common
inline fun <L, R> LeftProjection<L, R>.filterOrElse(predicate: (L) -> Boolean, zero: () -> R): Either<L, R>?
Returns the same Left if the predicate is satisfied for the value, Right(zero) if the predicate is not satisfied for the value, or the same Right if this is Right.
flatMap
Link copied to clipboard
common
inline fun <L, R, T> LeftProjection<L, R>.flatMap(transform: (L) -> Either<T, R>): Either<T, R>
Maps value of this Left to a new Either using transform.
getOrElse
Link copied to clipboard
common
inline fun <L, R> LeftProjection<L, R>.getOrElse(default: () -> L): L
Gets value of this Left or default value if this is Right.